<%@ page import="com.opensymphony.xwork2.util.ValueStack" %>
<%@ page import="java.util.List" %>
<%@ page import="examinee.ExamineeInfo" %>
<%@ page import="java.util.Map" %>
<%@ page import="exam.TestPaperInfo" %>
<%@ page import="utils.TextUtils" %>
<%@ page import="exam.ExamVar" %>
<%@ page import="account.AccountUtils" %>
<%@ page import="utils.Var" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <title></title>
    <link href="../../skin/default/global.css" rel="stylesheet" type="text/css"/>
    <link href="../../skin/default/layout.css" rel="stylesheet" type="text/css"/>
    <style>
        html, body {
            overflow-x: hidden
        }
    </style>
</head>
<%
    if (!AccountUtils.hasRight(session, Var.RIGHT_EXAM)) throw new Exception("deny!");

    ValueStack vs = (ValueStack) request.getAttribute("struts.valueStack");
    List<TestPaperInfo> tlist = (List<TestPaperInfo>) vs.findValue("tlist");
    Map<Long, ExamineeInfo> emap = (Map<Long, ExamineeInfo>) vs.findValue("examineeMap");

    int p = (Integer) vs.findValue("page");
    long ps = (Long) vs.findValue("pageSum");
    long sum = (Long) vs.findValue("sum");
%>
<body class="admin-content admin-panel-body">
<form id="printForm" action="../control/print.action" target="submithidden">
    <input type="hidden" name="tid"/>
</form>
<div class="admin-tablenav" style=" margin-bottom:-10px;width:98%">

    <div class="admin-tablenav-sum">考生总数：<strong><%=sum%>人</strong></div>
</div>
<!--<div class="icon" id="stat"></div>-->

<!--<h1 class="title stat">考试查询结果</h1>-->

<%--<div class="admin-tablenav" style="float:right; margin-bottom:-14px;">--%>
<%--<button type="button" class="normal" onclick="KS.print('print.jsp')"><span></span><img src="../../skin/default/print.gif"/>打印列表</button>--%>
<%--</div>--%>

<!--查询结果列表-->

<table cellpadding="0" cellspacing="0" class="admin-table" style="width:98%">
    <thead>
    <tr>
        <th><span class="first"></span>培训机构</th>
        <th style="width:60px">姓名</th>
        <th style="width:80px">准考证号</th>
        <th style="width:30px">成绩</th>
        <th style="width:30px">通过</th>
        <th style="width:30px">作弊</th>
        <th style="width:60px;padding-left:3px;" class="last">考试日期</th>
    </tr>
    </thead>
    <tbody id="statlist1">
    <%
        if (tlist.size() == 0) {
    %>
    <tr>
        <td colspan="7" class="first last">
            <div class="notice">查询结果为空</div>
        </td>
    </tr>
    <%
        }
        for (TestPaperInfo tinfo : tlist) {
            ExamineeInfo einfo = emap.get(tinfo.getEid());
            boolean tested = tinfo != null;
    %>
    <tr <%=tested ? "onclick=\"gotourl('" + einfo.getEname() + "','" + tinfo.getTid() + "')\"" : ""%>>
        <td class="first"><%=einfo.getPxjg()%>&nbsp;</td>
        <td><%=einfo.getEname()%>&nbsp;</td>
        <td><%=einfo.getZkzh()%>&nbsp;</td>
        <td><%=tinfo.getScore() != -1 ? String.valueOf(tinfo.getScore()) : "未考"%>&nbsp;</td>
        <td><%=tinfo.getScore() >= ExamVar.PASS_SCORE ? "是" : "否"%>&nbsp;</td>
        <td><%=tinfo.getCheat() == 1 ? "是" : "否"%>&nbsp;</td>
        <td><%=TextUtils.GetShowDate(einfo.getKsrq())%>&nbsp;</td>
    </tr>
    <%
        }
    %>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="7" class="last"><span class="first"></span>
            <a href="getTestScores.action">首页</a>
            | <a href="<%=p==1?"#":"getTestScores.action?page="+(p-1)%>">上一页</a>
            | <a href="<%=p==ps?"#":"getTestScores.action?page="+(p+1)%>">下一页</a>
            | <a href="getTestScores.action?page=<%=ps%>">末页</a>
            <select onchange="location.href='getTestScores.action?page='+this.value">
                    <%
              for (int i = 1; i <= ps; i++) {
            %>
                <option value="<%=i%>" <%=p == i ? "selected" : ""%>><%=i%>
                </option>
                    <%
              }
            %>
        </td>
    </tr>
    </tfoot>
</table>


<script src="../../common/jquery-1.3.2.min.js"></script>
<script src="../../common/jquery.blockUI.js"></script>
<script src="../../common/fun.js"></script>
<script>
    $(function() {
        list = new KS.List("statlist1", true)
        kswindow = new KS.Window();
    })
    function gotourl(name, data) {
        kswindow.open({title:'考试信息',url:'getTestDetail.action?tid=' + data + '&s=' + Math.random(),width:650})
        //window.parent.right.location = "getTestDetail.action?tid=" + data;
        //window.parent.fr.cols = "250,*,250"
    }
    function printScore(tid) {
        printForm.tid.value=tid;
        printForm.submit();
    }
</script>

</body>
<iframe name="submithidden" style="display:none" id="submithidden"></iframe>
</html>